/**
 * @file CommunicationFactory.cpp
 * @brief 通信工厂类实现
 * @author Your Name
 * @date 2025-03-30
 */

#include "communicationfactory.h"
#include "serialstrategy.h"
#include "compactprotocol.h"

ICommunicationStrategy* CommunicationFactory::createStrategy(StrategyType type) {
    switch (type) {
        case SERIAL:
            return new SerialStrategy();

        case TCP:
            // 待实现
            // return new TcpStrategy();

        case UDP:
            // 待实现
            // return new UdpStrategy();

        case BLUETOOTH:
            // 待实现
            // return new BluetoothStrategy();

        default:
            return nullptr;
    }
}

IProtocol* CommunicationFactory::createProtocol(ProtocolType type) {
    switch (type) {
        case COMPACT:
            return new CompactProtocol();

        case JSON:
            // 待实现
            // return new JsonProtocol();

        case MODBUS:
            // 待实现
            // return new ModbusProtocol();

        default:
            return nullptr;
    }
}
